import 'package:flutter/material.dart';
import 'package:hook_up_rent/pages/profile/widgets/function_button_data.dart';
import 'package:hook_up_rent/widgets/common_image.dart';

class FunctionButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Wrap(
        // 上下
        runSpacing: 1.0,
        // 左右
        spacing: 1.0,
        children: listBottomData
            .map((e) => _buildFunctionButtonItem(context, e))
            .toList(),
      ),
    );
  }

  Widget _buildFunctionButtonItem(
      BuildContext context, FunctionButtonItem functionButtonItem) {
    return Container(
      margin: EdgeInsets.only(top: 50),
      width: MediaQuery.of(context).size.width * 0.33,
      child: GestureDetector(
        onTap: () {
          functionButtonItem.onTapHandle(context);
        },
        child: Column(
          children: [
            CommonImage(
              functionButtonItem.imageUrl,
              // width: MediaQuery.of(context).size.width * 0.33,
            ),
            Text(functionButtonItem.title)
          ],
        ),
      ),
    );
  }
}
